
* File to: 1.merge game data and user information;2. keep zip and date and hour of the GameUserData for later data processing


***inputs:
* $Data/GameData.dta
* $Data/UserData.dta


***outputs:
* $Data/GameUserData.dta
* $Data/GameUser_zdh.dta


***1. MERGE GAME AND USER DATA ***

use $Data/GameData.dta, clear

joinby anon_id gamenum  anon_id using $Data/UserData.dta


save $Data/GameUserData.dta, replace





***2. COLLAPSE TO ZIP DATE HOUR LEVEL, KEEP ZIP DATE HOUR ONLY***

use $Data/GameUserData.dta, clear

keep zip date hour

duplicates drop

save $Data/GameUser_zdh.dta, replace


***2. COLLAPSE TO ZIP DATE LEVEL, KEEP ZIP DATE  ONLY***


use $Data/GameUser_zdh.dta, clear


keep zip date 

duplicates drop 

save $Data/GameUser_zd.dta, replace
